export default {
    data() {
        return {}
    },
    methods: {
        handleEdit() {
            this.tableNode = this.$refs.tableNode
        },
        async handleDelete({
            proxyConfig,
            confirmConfig
        }) {
            document.activeElement.blur()
            if (proxyConfig.params) {
                const confirm = await this.$confirm(confirmConfig.title, "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning"
                }).catch(() => { });
                if (!confirm) return;
                let { msg } = await proxyConfig.api(proxyConfig.params[proxyConfig.key]);
                this.$showMessage({ type: "success", message: msg });
                return this.refreshTable(true);
            }
            let data = this.getSelections(false);
            if (data.length == 0)
                return this.$showMessage({ type: "warning", message: "选择列表为空" });

            const confirm = await this.$confirm(confirmConfig.title, "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            }).catch(() => { });
            if (!confirm) return;
            let { msg } = await proxyConfig.api(data.map(i=>i[proxyConfig.key]).join(','));
            this.refreshTable(true);
            return this.$showMessage({ type: "success", message: msg });
        }
    }
}